package com.tank.collision;

import com.almasb.fxgl.entity.Entity;
import com.almasb.fxgl.physics.CollisionHandler;
import com.tank.constant.Config;
import com.tank.constant.GameType;

public class BulletBulletCollideHandler extends CollisionHandler {
    public BulletBulletCollideHandler() {
        super(GameType.BULLET, GameType.BULLET);
    }

    @Override
    protected void onCollisionBegin(Entity bullet1, Entity bullet2) {
        GameType t1 = bullet1.getObject(Config.OWNER_TYPE);
        GameType t2 = bullet2.getObject(Config.OWNER_TYPE);
        if (t1 != t2) {
            bullet1.removeFromWorld();
            bullet2.removeFromWorld();
        }
    }
}
